<template>
  <div class="header">
    <div class="content-wapper">
      <div class="avatar">
        <img :src="seller.avatar" width="64" height="64" alt="">
      </div>
      <div class="content">
        <div class="title">
          <span class="brand"></span>
          <span class="name">{{seller.name}}</span>
        </div>
        <div class="description">
          {{seller.description}}/{{seller.deliveryTime}}分钟送达
        </div>
        <!--此处如果没有用v-if会报错，传过来的是空-->
        <div v-if="seller.supports" class="supports">
          <span class="icon" :class="classMap[seller.supports[0].type]"></span>
          <span class="text">{{seller.supports[0].description}}</span>
        </div>
      </div>
      <div class="support-count" v-if="seller.supports"  @click="showData">
        <span class="count">{{seller.supports.length}}个</span>
        <i class="icon-keyboard_arrow_right"></i>
      </div>
    </div>
    <div class="bulletin-wapper" @click="showData">
      <span class="bulletin"></span><span class="introduce">{{seller.bulletin}}</span>
      <i class="icon-keyboard_arrow_right"></i>
    </div>
    <div class="background">
      <img :src="seller.avatar" width="100%" height="100%" alt="">
    </div>
    <popup :sellers="seller" :classMap="classMap" :popupShow="popupShow" :popupClose="popupClose"></popup>
  </div>
</template>

<script>
  import popup from './popup.vue';
export default {
  props: {
    seller: { //接收seller传过来的数据
      type:Object
    }
  },
  data () {
        return {
            'popupShow': false,
            'sellers': {}
        }
    },
  components: {
    'popup': popup
  },
  created () {
    this.classMap=['decrease','discount','guarantee','invoice','special'];
  },  
  methods: {
    showData () {
          this.popupShow = true;
        },
    popupClose () {
        this.popupShow = false;
        }
   }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
  @import '../../common/scss/mixin.scss';
  .header {
    position: relative;
    background: rgba(7, 17, 27, 0.5);
    /*filter: blur(10px);*/
    color: rgb(255, 255, 255);
    /*修复背景虚化时的阴影*/
    overflow: hidden;
    .content-wapper {
      /*使图片和文字的默认距离为0*/
      font-size: 0px;
      position: relative;
      .avatar {
        display: inline-block;
        width: 64px;
        height: 64px;
        padding: 24px 0px 18px 24px;
        img {
          border-radius: 4px;
        }
      }
      .content {
        display: inline-block;
        margin-left: 16px;
        font-weight: 200;
        .title {
          margin-bottom: 8px;
          .name {
            font-size: 16px;
            font-weight: 700;
            vertical-align: top;
            line-height: 24px;
          }
          .brand {
            display: inline-block;
            width: 30px;
            height: 18px;
            @include bg-image ('brand');
            background-size: 30px 18px;
            background-repeat: no-repeat;
            margin: 2px 6px 0px 0px;
          }
        }
        .description {
          font-size: 12px;
          line-height: 12px;
          margin-bottom: 10px;
        }
        .supports {
          font-size: 0;
          .icon {
            display: inline-block;
            margin-right: 4px;
            width: 12px;
            height: 12px;
            background-size: 12px 12px;
            background-repeat: no-repeat;
            &.decrease {
              @include bg-image ('decrease_1');
            }
            &.discount {
              @include bg-image ('discount_1');
            }
            &.guarantee {
              @include bg-image ('guarantee_1');
            }
            &.invoice {
              @include bg-image ('invoice_1');
            }
            &.special {
              @include bg-image ('special_1');
            }
          }
          .text {
            font-size: 10px;
            vertical-align: top;
            line-height: 14px;
          }
        }
      }
      .support-count {
        position: absolute;
        right: 12px;
        bottom: 18px;
        padding: 0 8px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 14px;
        text-align: center;
        font-size: 0;
        .count {
          font-size: 10px;
          line-height: 24px;
          vertical-align: top;
        }
        .icon-keyboard_arrow_right {
          font-size: 10px;
          line-height: 24px;
        }
      }
    }
    .bulletin-wapper {
      position: relative;
      height: 28px;
      line-height: 28px;
      padding: 0 22px 0 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      background: rgba(7, 17, 27, 0.2);
      .bulletin {
        display: inline-block;
        width: 22px;
        height: 12px;
        background-size: 22px 12px;
        background-repeat: no-repeat;
        @include bg-image ("bulletin");
      }
      .introduce {
        font-size: 10px;
        vertical-align: top;
        margin: 0 4px;
      }
      .icon-keyboard_arrow_right {
        position: absolute;
        right: 12px;
        bottom: 8px;
        font-size: 10px;
      }
    }
    .background {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      filter: blur(10px);
      z-index: -1;
    }
  }
</style>